class Rational {
private:
	int p;
	int q;

	void swap(Rational& r);
	void normalize();

public:
	Rational(int m, int n = 1); 
	Rational(const Rational& r);

	Rational& operator= (const Rational& r);
	Rational& operator+= (const Rational& r);
	Rational& operator-= (const Rational& r);
	Rational& operator*= (const Rational& r);
	Rational& operator/= (const Rational& r);
	Rational& operator++();
	Rational operator++(int);
	Rational& operator--();
	Rational operator--(int);

	int getNumerator() const;
	int getDenominator() const;
	void print() const;

	operator double ();
};

Rational operator+ (const Rational& a, const Rational& b);
Rational operator- (const Rational& a, const Rational& b);
Rational operator* (const Rational& a, const Rational& b);
Rational operator/ (const Rational& a, const Rational& b);

bool operator== (const Rational& a, const Rational& b);
bool operator!= (const Rational& a, const Rational& b);
bool operator<= (const Rational& a, const Rational& b);
bool operator>= (const Rational& a, const Rational& b);
bool operator<  (const Rational& a, const Rational& b);
bool operator>  (const Rational& a, const Rational& b);
